<template>
	<view class="dubucd-des" :style="{top:height+16+'px'}" @click="shoucan">
		<image class="dubucd-des-img" v-if="!data.isCollection" src="https://hshd.tour-ma.com/r/cms/www/weifang/ximg/bh-ms-di-sc.png"></image>
		<image class="dubucd-des-img" v-if="data.isCollection" src="https://hshd.tour-ma.com/r/cms/www/weifang/ximg/icon-ysc.png"></image>
	</view>
</template>

<script>
	import web from'./request.js'
	export default{
		props:['scinfo','height'],
		data(){
			return{
				data:{}
			}
		},
		mounted() {
			this.data=this.scinfo;
		},
		watch:{
			scinfo(){
				this.data=this.scinfo;
				console.log(this.data)
			}
		},
		methods:{
			shoucan(){//收藏
				var url='/center/collect_save.jspx';
				var isCollection=!this.data.isCollection;
				var para={
					uuid:this.data.uuid,
					orderType:this.data.orderType,
					isCollection:isCollection
				};
				var that=this;
				web.httpPost(that,url,para,function(res){
					if(res.data.status==200){
						if(isCollection){
							uni.showToast({
								title: '收藏成功'
							});
						}else{
							uni.showToast({
								title: '取消成功'
							});
						}
						var name='scchange'+that.data.orderType;
						console.log(name)
						uni.$emit(name,{
							is:true
						})
					}
				})
			},
		}
	}
</script>

<style>
	.dubucd-des{
		position: absolute;
		top: 140rpx;
		z-index: 99;
		right: 30rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 60rpx;
		height: 60rpx;
		border-radius: 50%;
		background: rgba(255,255,255,0.8);
	}
	.dubucd-des-img {
		width: 36upx;
		height: 36upx;
	}
</style>
